/* Resize Window Width */
jQuery(document).ready(function() {
    manageMenu(false);

    jQuery(window).resize(function(){
        if(jQuery(window).width() > 780){
            jQuery('header').css({height:'75px'}).addClass('top-header-shadow');
            jQuery('header div img:first-child').show().css({
                margin: '5px 20px 2px 0px',
                float: 'left'
            });
            jQuery('.hideListItem').addClass('hide');
        }else if(jQuery(window).width() < 780 && jQuery('header').height() < 76){
            jQuery('.navigation ul li:first-child').css({
                backgroundImage:'url("/img/circle-down.png")',
                backgroundRepeat: 'no-repeat',
                backgroundPosition: '80% 30px'
            });
            jQuery('header div img:first-child').hide();
        }
    });

    jQuery('.navigation ul li:first-child').click(function(){
        manageMenu(true);
    });

    function manageMenu(isClickAButton) {
        var headerHeight =  jQuery('header').height();
        var windowWidth = jQuery(window).width();
        if(headerHeight > 364 && windowWidth < 780){
            jQuery('.navigation ul li:first-child').css({
                backgroundImage:'url("/img/circle-down.png")',
                backgroundRepeat: 'no-repeat',
                backgroundPosition: '80% 30px'
            });
            jQuery('header div img:first-child').hide();
            jQuery('header').css({height:'75px'});
            jQuery('.hideListItem').addClass('hide');
        }else if(headerHeight < 76){
            jQuery('.navigation ul li:first-child').css({
                backgroundImage:'url("/img/circle-down.png")',
                backgroundRepeat: 'no-repeat',
                backgroundPosition: '80% 30px'
            });
            jQuery('.navigation').css({display:'block'});
            if (isClickAButton) {
                jQuery('header').css({height:'380'});
                jQuery('header div img:first-child').show();
                jQuery('.navigation ul li:first-child').css({backgroundImage:'url("/img/circle-up.png")'});
                jQuery('.hideListItem').removeClass('hide');
            } else {
                if (windowWidth < 780) {
                    jQuery('header div img:first-child').hide();
                }
                jQuery('.hideListItem').addClass('hide');
            }
        }
    }
});